GtkThemingEngine: handle expander transitions to active, and rtl
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 13 Dec 2010 11:37:40 +0000 (12:37 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Mon, 13 Dec 2010 21:31:28 +0000 (22:31 +0100)
gtk/gtkthemingengine.c

index 0994f4da36f9c5c4a4d53fc067e71d12b1c0cbfe..be50e9e8163fddf07fee2c99b4e112b726abf98b 100644 (file)
@@ -1986,6 +1986,8 @@ gtk_theming_engine_render_expander (GtkThemingEngine *engine,
   double x_double, y_double;
   gdouble angle;
   gint line_width;
+  gboolean running, is_rtl;
+  gdouble progress;
 
   cairo_save (cr);
   flags = gtk_theming_engine_get_state (engine);
@@ -1993,23 +1995,23 @@ gtk_theming_engine_render_expander (GtkThemingEngine *engine,
   gtk_theming_engine_get (engine, flags,
                           "color", &fg_color,
                           NULL);
-  gtk_theming_engine_get (engine, 0,
-                          "color", &outline_color,
+  gtk_theming_engine_get (engine, flags,
+                          "border-color", &outline_color,
                           NULL);
 
+  running = gtk_theming_engine_state_is_running (engine, GTK_STATE_ACTIVE, &progress);
+  is_rtl = (gtk_theming_engine_get_direction (engine) == GTK_TEXT_DIR_RTL);
   line_width = 1;
 
-  /* FIXME: LTR/RTL */
-  if (flags & GTK_STATE_FLAG_ACTIVE)
-    {
-      angle = G_PI / 2;
-      interp = 1.0;
-    }
+  if (!running)
+    progress = (flags & GTK_STATE_FLAG_ACTIVE) ? 1 : 0;
+
+  if (is_rtl)
+    angle = (G_PI) - ((G_PI / 2) * progress);
   else
-    {
-      angle = 0;
-      interp = 0;
-    }
+    angle = (G_PI / 2) * progress;
+
+  interp = progress;
 
   /* Compute distance that the stroke extends beyonds the end
    * of the triangle we draw.